package com.cangshukj.junong.service.impl;

import java.util.List;
import com.cangshukj.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cangshukj.junong.mapper.ProductTypesMapper;
import com.cangshukj.junong.domain.ProductTypes;
import com.cangshukj.junong.service.IProductTypesService;

/**
 * 农产品分类Service业务层处理
 * 
 * @author wangjie
 * @date 2025-04-01
 */
@Service
public class ProductTypesServiceImpl implements IProductTypesService 
{
    @Autowired
    private ProductTypesMapper productTypesMapper;

    /**
     * 查询农产品分类
     * 
     * @param typeId 农产品分类主键
     * @return 农产品分类
     */
    @Override
    public ProductTypes selectProductTypesByTypeId(String typeId)
    {
        return productTypesMapper.selectProductTypesByTypeId(typeId);
    }

    /**
     * 查询农产品分类列表
     * 
     * @param productTypes 农产品分类
     * @return 农产品分类
     */
    @Override
    public List<ProductTypes> selectProductTypesList(ProductTypes productTypes)
    {
        return productTypesMapper.selectProductTypesList(productTypes);
    }

    /**
     * 新增农产品分类
     * 
     * @param productTypes 农产品分类
     * @return 结果
     */
    @Override
    public int insertProductTypes(ProductTypes productTypes)
    {
        productTypes.setCreateTime(DateUtils.getNowDate());
        return productTypesMapper.insertProductTypes(productTypes);
    }

    /**
     * 修改农产品分类
     * 
     * @param productTypes 农产品分类
     * @return 结果
     */
    @Override
    public int updateProductTypes(ProductTypes productTypes)
    {
        productTypes.setUpdateTime(DateUtils.getNowDate());
        return productTypesMapper.updateProductTypes(productTypes);
    }

    /**
     * 批量删除农产品分类
     * 
     * @param typeIds 需要删除的农产品分类主键
     * @return 结果
     */
    @Override
    public int deleteProductTypesByTypeIds(String[] typeIds)
    {
        return productTypesMapper.deleteProductTypesByTypeIds(typeIds);
    }

    /**
     * 删除农产品分类信息
     * 
     * @param typeId 农产品分类主键
     * @return 结果
     */
    @Override
    public int deleteProductTypesByTypeId(String typeId)
    {
        return productTypesMapper.deleteProductTypesByTypeId(typeId);
    }
}
